/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_ippu_define.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_MAI_IPPU_DEFINE_H__
#define __EI_MAI_IPPU_DEFINE_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

#include "ei_mai_errno.h"
#include "ei_mai_comm_define.h"
#include "ei_comm_ippu.h"

#define EI_MAI_ERR_IPPU_NULL_PTR        EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_NULL_PTR)
#define EI_MAI_ERR_IPPU_NOTREADY        EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_SYS_NOTREADY)
#define EI_MAI_ERR_IPPU_INVALID_DEVID   EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_INVALID_DEVID)
#define EI_MAI_ERR_IPPU_INVALID_CHNID   EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_INVALID_CHNID)
#define EI_MAI_ERR_IPPU_EXIST           EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_EXIST)
#define EI_MAI_ERR_IPPU_UNEXIST         EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_UNEXIST)
#define EI_MAI_ERR_IPPU_NOT_SUPPORT     EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_NOT_SUPPORT)
#define EI_MAI_ERR_IPPU_NOT_PERM        EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_NOT_PERM)
#define EI_MAI_ERR_IPPU_NOMEM           EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_NOMEM)
#define EI_MAI_ERR_IPPU_NOBUF           EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_NOBUF)
#define EI_MAI_ERR_IPPU_ILLEGAL_PARAM   EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_ILLEGAL_PARAM)
#define EI_MAI_ERR_IPPU_BUSY            EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_BUSY)
#define EI_MAI_ERR_IPPU_BUF_EMPTY       EI_MADP_DEF_ERR(EI_MADP_MOD_IPPU, MADP_EN_ERR_LEVEL_ERROR, MADP_EN_ERR_BUF_EMPTY)

#define IPPU_MAX_NUM		2
#define VPORT_PHY_MAX_NUM	IPPU_PHY_CHN_MAX_NUM
#define VPORT_EXT_MAX_NUM	IPPU_EXT_CHN_MAX_NUM
#define VPORT_MAX_NUM		(VPORT_PHY_MAX_NUM + VPORT_EXT_MAX_NUM)

typedef enum hiEI_MADP_IPPU_CMD_E
{
	EI_MADP_IPPU_CMD_SetRotate,
    EI_MADP_IPPU_CMD_GetRotate,
    EI_MADP_IPPU_CMD_CreateOsd,
    EI_MADP_IPPU_CMD_SetOsd,
    EI_MADP_IPPU_CMD_DestroyOsd,
    EI_MADP_IPPU_CMD_CreateRect,
    EI_MADP_IPPU_CMD_SetRect,
    EI_MADP_IPPU_CMD_DestroyRect,
    EI_MADP_IPPU_CMD_CreateMasaic,
    EI_MADP_IPPU_CMD_DestroyMasaic,
    EI_MADP_IPPU_CMD_CreateCover,
    EI_MADP_IPPU_CMD_SetCover,
    EI_MADP_IPPU_CMD_DestroyCover,
    EI_MADP_IPPU_CMD_CreateLine,
    EI_MADP_IPPU_CMD_SetLine,
    EI_MADP_IPPU_CMD_DestroyLine,
    EI_MADP_IPPU_CMD_GetIspFrameInfo,
	EI_MADP_IPPU_CMD_GetIspEffect,
	EI_MADP_IPPU_CMD_SetIspEffect,
	EI_MADP_IPPU_CMD_SetExposure,
    EI_MADP_IPPU_CMD_GetExposure,
    EI_MADP_IPPU_CMD_SetWBAttr,
    EI_MADP_IPPU_CMD_GetWBAttr,
    EI_MADP_IPPU_CMD_SetMirror,
    EI_MADP_IPPU_CMD_GetMirror,
    EI_MADP_IPPU_CMD_SetFlip,
    EI_MADP_IPPU_CMD_GetFlip,
    /*
    EI_MADP_IPPU_CMD_SetSaturation,
    EI_MADP_IPPU_CMD_GetSaturation,
    EI_MADP_IPPU_CMD_SetSharpen,
    EI_MADP_IPPU_CMD_GetSharpen,
    EI_MADP_IPPU_CMD_SetBrightness,
    EI_MADP_IPPU_CMD_GetBrightness,
    EI_MADP_IPPU_CMD_SetLDC,
    EI_MADP_IPPU_CMD_GetLDC,
    EI_MADP_IPPU_CMD_QUERY_EXPOSURE_INFO,
    EI_MADP_IPPU_CMD_ISP_SetPipeDiffAttr,
    EI_MADP_IPPU_CMD_ISP_GetPipeDiffAttr,
    EI_MADP_IPPU_CMD_ISP_SetMode,
    EI_MADP_IPPU_CMD_QUERY_WB_INFO,
    EI_MADP_IPPU_CMD_ISP_INIT,
    */
    EI_MADP_IPPU_CMD_BUTT
}EI_MADP_IPPU_CMD_E;

typedef struct eiIPPU_ATTREX_S
{
	EI_HANDLE handle;			/* handle for Osd, rect, cover, 0 ~ 127*/
	union {
		EI_MADP_ROTATE_E stRotate;
		EI_MADP_OSD_ATTR_S stOsdAttr;
		EI_MADP_RECT_ATTR_S stRectAttr;
		EI_MADP_MOSAIC_ATTR_S stMosaicAttr;
		EI_MADP_COVER_ATTR_S stCoverAttr;
		EI_MADP_LINE_ATTR_S stLineAttr;
		EI_MADP_ISP_FRAME_INFO_S stIspFrameInfo;
		EI_MADP_ISP_EFFECT_S stIspEffect;
		EI_MADP_EXPOSURE_S stExposure;
		EI_MADP_WB_ATTR_S stWBAttr;
		EI_MADP_MIRROR_ATTR_S stMirror;
		EI_MADP_FLIP_ATTR_S stFlip;
	};
} IPPU_ATTREX_S;

typedef enum eiIPPU_TYPE_E
{
    IPPU_TYPE_VIDEO = 0,
    IPPU_TYPE_SNAP,
    IPPU_TYPE_BUTT
} EI_IPPU_TYPE_E;

typedef struct eiIPPU_POINT_S
{
    EI_S32 s32X;
    EI_S32 s32Y;
}EI_IPPU_POINT_S;

typedef struct eiIPPU_STITCH_BLEND_ATTR_S
{
    EI_IPPU_POINT_S stOverlapPoint[4];
}EI_IPPU_STITCH_BLEND_ATTR_S;

typedef struct eiIPPU_STITCH_ATTR_S
{
    EI_U32 u32OutWidth;
    EI_U32 u32OutHeight;
    EI_MADP_POINT_S stOverlapPoint[4];
} EI_IPPU_STITCH_ATTR_S;

typedef struct eiIPPU_ATTR_S
{
    EI_IPPU_TYPE_E enIPPUType;
    /*
    EI_U32 u32MaxW;
    EI_U32 u32MaxH;
	EI_U32 u32SrcDev;
	EI_BOOL bStitchEnable;
    EI_IPPU_STITCH_ATTR_S stStitchAttr;
    */
} EI_IPPU_ATTR_S;

typedef struct eiVPORT_ATTR_S
{
    EI_S32 s32FrameRate;
    EI_MADP_RESOLUTION_S stResolution;
    EI_MADP_PIXEL_FORMAT_E enPixFormat;
    EI_COMPRESS_MODE_E enCompressMode;
	EI_U32 u32Depth;
	EI_MADP_ROTATE_E enRotate;
} EI_VPORT_ATTR_S;

typedef struct eiEXT_VPORT_ATTR_S
{
    EI_S32 s32FrameRate;
    EI_MADP_RESOLUTION_S stResolution;
    EI_MADP_PIXEL_FORMAT_E enPixFormat;
    EI_COMPRESS_MODE_E enCompressMode;
	EI_U32 u32Depth;
} EI_EXT_VPORT_ATTR_S;

typedef EI_S32 (*PFN_IPPU_YUVDataProc)(EI_HANDLE IPPUHdl, EI_HANDLE VPortHdl, EI_FRAME_DATA_S* pVPortYUV);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif

